#!/usr/bin/python
# -*- coding: utf-8 -*-
# @version        : 1.0
# @Create Time    : 2023/02/12 22:18
# @File           : enum.py
# @IDE            : PyCharm
# @desc           : 增加枚举类方法

from enum import Enum


class SuperEnum(Enum):
    @classmethod
    def to_dict(cls):
        """Returns a dictionary representation of the enum."""
        return {e.name: e.value for e in cls}

    @classmethod
    def keys(cls):
        """Returns a list of all the enum keys."""
        return cls._member_names_

    @classmethod
    def values(cls):
        """Returns a list of all the enum values."""
        return list(cls._value2member_map_.keys())


class IntEnum(int, SuperEnum): ...


class StrEnum(str, SuperEnum): ...


class MethodType(StrEnum):
    GET = "GET"
    POST = "POST"
    PUT = "PUT"
    DELETE = "DELETE"
    PATCH = "PATCH"


class GenderEnum(IntEnum):
    # 男生
    MALE = 0
    # 女生
    FEMALE = 1
    # 未知
    UNKNOWN = 2


class RoleScopeEnum(IntEnum):
    # 权限范围
    # 自己
    SELF = 0
    # 部门及子部门
    DEPARTMENT_AND_SUBDEPARTMENT = 2
    # 当前部门
    DEPARTMENT = 1
    # 自定义
    CUSTOM = 3
    # 全部
    ALL = 4


class MenuEnum(IntEnum):
    # 菜单类型
    # 目录
    DIRECTORY = 0
    # 菜单
    MENU = 1
    # 按钮
    BUTTON = 2


class StatusType(StrEnum):
    enable = "1"
    disable = "2"


class DateScopeEnum(IntEnum):
    """
    0 仅本人数据权限
    1 本部门数据权限
    2 本部门及以下数据权限
    3 自定义数据权限
    4 全部数据权限
    """

    SELF = 0
    DEPT = 1
    DEPT_AND_CHILDREN = 2
    CUSTOM = 3
    ALL = 4


# 定时任务分组 'memory' or 'redis'
class JobGroupEnum(StrEnum):
    memory = "memory"
    redis = "redis"


# 上传文件类型
class FileTypeEnum(StrEnum):
    image = "image"
    video = "video"
    audio = "audio"
    file = "file"
